package com.estasenposse.tdam.ui;

import com.example.estasenposse.R;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.widget.ProgressBar;

public class WebFarmaciaActivity extends Activity {

	private WebView browser;
	private ProgressBar pg_loader;

	@SuppressLint("NewApi") @Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.webfarmacia_activity);
		getActionBar().setTitle("Farmacias de turno");

		browser = (WebView) findViewById(R.id.wv_farmacias_web);
		pg_loader = (ProgressBar) findViewById(R.id.pg_cargarFarmacia);
		browser.loadUrl("http://www.estasenposse.com/utiles/farmacias.php");		
		browser.setWebChromeClient(new WebChromeClient() {
			@Override
			public void onProgressChanged(WebView view, int progress) {
				pg_loader.setProgress(0);
				pg_loader.setVisibility(View.VISIBLE);
				pg_loader.incrementProgressBy(progress);
				if (progress == 100) {
					pg_loader.setVisibility(View.GONE);
				}
			}
		});

	}

}
